<!--
 * @Descripttion: 
 * @version: 
 * @Author: Ansel
 * @Date: 2020-03-04 23:00:24
 * @LastEditors: Ansel
 * @LastEditTime: 2020-05-20 13:14:25
--> 
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        function _new(){
            let target = {};

            let [constructor, ...args] = [...arguments];

            target.__proto__ = constructor.prototype;

            let result = constructor.apply(target, args);
            if(result && (typeof result === "object" ||  typeof result === "function")){
                return result;
            }
            return target;
        }

        function Person(name,sex){
            this.name = name;
            this.sex = sex;
        }

        let person = _new(Person,"ctx","male");
        console.log(person); 
    </script>
</body>
</html>